import { execSync,exec } from "child_process";
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const sources = require('../../registries.json');
export const getGetRegistryInfo = () => {
  // 设置命令行编码为UTF-8，以支持显示中文字符
  // exec("chcp 65001");

  // 获取所有Wi-Fi配置文件的名称
  const profilesInfo = execSync("npm config get registry").toString().trim();
  let correspondingKey;  
  for (let key in sources) {
    if (sources[key].registry === profilesInfo) {
      correspondingKey = key;
      break;
    }
  }
  if (correspondingKey === 'npm') {
    const result = execSync("npx nrm use taobao").toString().trim();
    console.log(result,'result')
  }
}
